var Adv_skd=require("./Adv_skd")

var e = require;
var t = module;
var o = exports;
var n,
    i = o,
    a =
        ((n = function (e, t) {
            return (n =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (e, t) {
                        e.__proto__ = t;
                    }) ||
                function (e, t) {
                    for (var o in t) t.hasOwnProperty(o) && (e[o] = t[o]);
                })(e, t);
        }),
        function (e, t) {
            function o() {
                this.constructor = e;
            }
            n(e, t), (e.prototype = null === t ? Object.create(t) : ((o.prototype = t.prototype), new o()));
        }),
    r = function (e, t, o, n) {
        var i,
            a = arguments.length,
            r = a < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, o)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(e, t, o, n);
        else
            for (var s = e.length - 1; s >= 0; s--)
                (i = e[s]) && (r = (a < 3 ? i(r) : a > 3 ? i(t, o, r) : i(t, o)) || r);
        return a > 3 && r && Object.defineProperty(t, o, r), r;
    };
Object.defineProperty(i, "__esModule", {value: !0});
var s = e("GameData"),
    c = cc._decorator,
    l = c.ccclass,
    d =
        (c.property,
        window.wx,
        (function (e) {
            function t() {
                var t = (null !== e && e.apply(this, arguments)) || this;
                return (t.content = null), (t.btn_getCoin = null), (t.GetCoinTipIndex = 100), (t.tip_label = null), t;
            }
            return (
                a(t, e),
                (t.prototype.onResetView = function () {
                    e.prototype.onResetView.call(this),
                        ad.curr_platform == window.ad.Platform.MEI_ZU
                            ? ad.adInterface.showInterstitial()
                            : ad.curr_platform == window.ad.Platform.HUAWEI_GAME
                                ? ad.adInterface.showNativeInterstitial()
                                : ad.curr_platform == window.ad.Platform.BAI_DU && ad.adInterface.showBanner(),
                        this.init();

                    Adv_skd.default.instance.hideAllAdv();
                    Adv_skd.default.instance.showGridAdRight();
                    Adv_skd.default.instance.showGridAdLeft();
                    Adv_skd.default.instance.showInterstitialAd();
                    
                }),
                (t.prototype.onClickClose = function () {
                    Adv_skd.default.instance.hideAllAdv();

                    Adv_skd.default.instance.showGridAdLeftOne();
                    Adv_skd.default.instance.showGridAdRightOne();
                    Adv_skd.default.instance.showInterstitialAd();

                    game.AudioManager.playBtnEffect(), this.closeView(!0);
                }),
                (t.prototype.onDisable = function () {
                    ad.curr_platform == window.ad.Platform.BAI_DU && ad.adInterface.hideBanner(!1);
                }),
                (t.prototype.registerMediator = function () {
                    e.prototype.registerMediator.call(this);
                }),
                (t.prototype.removeMediator = function () {
                    e.prototype.removeMediator.call(this);
                }),
                (t.prototype.addEvent = function () {
                    e.prototype.addEvent.call(this),
                        this.btn_getCoin.on(game.EngineEventType.NodeEvent.click, this.onClickGetCoin, this);
                }),
                (t.prototype.removeEvent = function () {
                    e.prototype.removeEvent.call(this),
                        this.btn_getCoin.off(game.EngineEventType.NodeEvent.click, this.onClickGetCoin, this);
                }),
                (t.prototype.onClickGetCoin = function () {
                    game.AudioManager.playBtnEffect();
                    var e = ad.curr_platform === window.ad.Platform.TOU_TIAO;
                    game.log("T=> 钻石礼包"), e && window.tt.reportAnalytics("ZhuanShiLiBao", {});
                    var t = this;
                    ad.adInterface.showRewardedVideo(null, null, function () {
                        var e = s.default.instance.getPlayerCoin();
                        s.default.instance.setPlayerCoin(e + 900),
                            s.default.instance.setCoinTipIndex(t.GetCoinTipIndex - 1),
                            t.refreshView(),
                            game.UIManager.instance.showToast("领取成功");
                    });
                }),
                (t.prototype.init = function () {
                    (this.isCache = !1),
                        (this.content = this.node.getChildByName("content")),
                        (this.btn_getCoin = this.content.getChildByName("btn_getCoin")),
                        (this.tip_label = this.content.getChildByName("tip_label")),
                        this.content.getChildByName("bg_light").runAction(cc.repeatForever(cc.rotateBy(3, 60))),
                        this.refreshView();
                }),
                (t.prototype.refreshView = function () {
                    if (
                        ((this.GetCoinTipIndex = s.default.instance.getCoinTipIndex()),
                        (this.tip_label.getComponent(cc.Label).string = "今日剩余" + this.GetCoinTipIndex + "次"),
                        this.GetCoinTipIndex <= 0)
                    ) {
                        var e = this;
                        this.scheduleOnce(function () {
                            e.closeView(!1);
                        }, 1);
                    }
                }),
                r([l], t)
            );
        })(game.BasePopView));
i.default = d;
